<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>黑名单管理</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
		$(document).ready(function() {
			$("#value").focus();
			$("#inputForm").validate({
				rules: {
					mobile: {remote: "${ctx}/sys/blockList/checkMobile?oldMobile=" + encodeURIComponent('${blockList.mobile}')},
					idCard: {remote: "${ctx}/sys/blockList/checkIdCard?oldIdCard=" + encodeURIComponent('${blockList.idCard}')},
				},
				messages: {
					mobile: {remote: "手机号黑名单已经存在"},
					idCard:{remote:"身份证号已存在"}
				},
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/sys/blockList/">黑名单列表</a></li>
		<li class="active"><a
			href="${ctx}/sys/blockList/form?id=${blockList.id}">黑名单<shiro:hasPermission
					name="sys:blockList:add">${not empty blockList.id?'修改':'添加'}</shiro:hasPermission>
				<shiro:lacksPermission name="sys:blockList:edit">查看</shiro:lacksPermission></a></li>
	</ul>
	<br />
	<form:form id="inputForm" modelAttribute="blockList"
		action="${ctx}/sys/blockList/save" method="post"
		class="form-horizontal">
		<form:hidden path="id" />
		<tags:message content="${message}" />
		<div class="control-group">
			<label class="control-label">姓名:</label>
			<div class="controls">
				<form:input path="name" htmlEscape="false" maxlength="10"
					class="required" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">手机:</label>
			<div class="controls">
			    <input id="oldMobile" name="oldMobile" type="hidden" value="${user.mobile}">
				<form:input path="mobile" htmlEscape="false" maxlength="15" onkeyup="this.value=this.value.replace(' ','')"/>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">身份证号:</label>
			<div class="controls">
			    <input id="oldIdCard" name="oldIdCard" type="hidden" value="${user.idCard}">
				<form:input path="idCard" htmlEscape="false" maxlength="18" onkeyup="this.value=this.value.replace(' ','')"/>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">描述:</label>
			<div class="controls">
				<form:textarea path="remark" htmlEscape="false" class="span8" 
				placeholder="请填写描述！"/>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="sys:blockList:add">
				<input id="btnSubmit" class="btn btn-primary" type="submit"
					value="保 存" />&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回"
				onclick="history.go(-1)" />
		</div>
	</form:form>
</body>
</html>